package pl.perseus.dao;
 
import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Repository;

import pl.perseus.model.User;
import pl.perseus.model.UserAccount;

@Repository
public class UserAccountDao extends BaseDao<UserAccount> implements IUserAccountDao{
 
	
	public UserAccountDao() {
		super("UserAccount");
	}

	@Override
    public UserAccount selectByIdUserAccount(Long id) {
    	Map<String, Object> map = new HashMap<String, Object>();
    	map.put("id", id);
        return queryForObject("getByIdUserAccount", map);
    }
	
	@Override
	public UserAccount insertUserAccount(UserAccount userAccount){
		return insertBean("insertUserAccount", userAccount);
	}
	
	@Override
	public void deleteByUser(User u){
		UserAccount ua = new UserAccount();
		ua.setId_user(u.getId());
		delete("deleteByUser", ua);
	}
 
}
